<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>编辑公告信息</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/plugins/jQuery/themes/default/easyui.css"/>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/plugins/jQuery/themes/icon.css"/>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/plugins/jQuery/demo.css"/>
<script src="${pageContext.request.contextPath }/plugins/jQuery/jquery.min.js"></script>
<script src="${pageContext.request.contextPath }/plugins/jQuery/jquery.easyui.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/jQuery/easyui-lang-zh_CN.js"></script>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/admin/css/input1.css"/>
<script>
	$(function(){
//		$.messager.alert('系统消息','子栏目删除成功！');
		// 区域负责人下拉列表
		$('#chargeUser').combobox({
			valueField:'userid',
			textField:'username',
			url:'${pageContext.request.contextPath }/admin/user/listUserByRole/2'
		});
		$('#chargeUser').combobox("setValue",-1);
		
		// 站点类型下拉列表
		$('#noticeKind').combobox({
			valueField:'value',
			textField:'text',
			data:[{"value":"1","text":"财务"},
				{"value":"2","text":"中心仓"},
				{"value":"3","text":"市场/销售"},
				{"value":"4","text":"采购/商品"},
				{"value":"5","text":"系统调整"},
				{"value":"6","text":"其他"},
			]
		});
		$('#noticeKind').combobox("setValue",${notice.NOTICE_KIND});
		
		$("a[name='qsave']").linkbutton({text:'保存公告信息',plain:true,iconCls:'icon-ok'});
		$("a[name='upload']").linkbutton({text:'重新上传',plain:true,iconCls:'icon-my-add'});
		$("a[name='find']").linkbutton({text:'点击查看',plain:true,iconCls:'icon-my-find'});
		$('#dlg').dialog('close');
	});
	
	function showFonts(){
		var content=$('#content').val();
		alert(content);
	}
	
	function doSub(){
		var sname=$('#sname').val();
		if($.trim(sname)==''){
			$.messager.alert('系统消息','<span style="color:red;">公告标题必须输入！</span>');
			$('#sname').textbox('textbox').focus(); 
    		return;
		}
		var startDate=$('#startDate').datetimebox('getValue'); 
		if(startDate==null || $.trim(startDate)==""){
			$.messager.alert('系统消息','<span style="color:red;">公告开始日期必须选择！</span>');
    		return;
		}
		var endDate=$('#endDate').datetimebox('getValue'); 
		if(endDate==null || $.trim(endDate)==""){
			$.messager.alert('系统消息','<span style="color:red;">公告结束日期必须选择！</span>');
    		return;
		}
		$('#addNotice').submit();
	}
	
	function showImg(imgUrl){
		$('#dlg').dialog('open');
		var image=document.getElementById("stationImg");
		image.setAttribute("src",imgUrl );
	}
	
	function uploadImg(){
		$('#upload').hide();
		$('#uploadFile').show();
	}
</script>
</head>

<body>
<form method="post" id="addNotice" action="${pageContext.request.contextPath }/admin/notice/editNotice" enctype="multipart/form-data">
<div class="i-container" style="width:1000px;">
	<div class="i-common i-title">修改公告信息
		<span style="color:red; margin-left:30px;">${addMsg }</span>
		<div class="i-btn"><a id="btn" href="javascript:doSub()" name="qsave"></a></div><div style=" clear:both;"></div>
	</div>
    <div class="i-common i-cnt-left">公告标题：</div><div class="i-common i-cnt-right">
    	<input type="hidden" name="notice.NOTICE_ID" value="${notice.NOTICE_ID }"/>
    	<input name="notice.NOTICE_TITLE" id="sname" class="easyui-textbox" style="width:210px;height:26px" value="${notice.NOTICE_TITLE }"/>
    </div>
    <div class="i-common i-cnt-middle">公告开始时间：</div>
    <div class="i-common i-cnt-right">
    	<input name="notice.START_DATE" id="startDate" class="easyui-datebox" style="width:210px;height:26px" value="${notice.START_DATE }"/>
    </div>
    <div class="i-common i-cnt-middle">公告结束时间：</div>
    <div class="i-common i-cnt-right">
    	<input name="notice.END_DATE" id="endDate" class="easyui-datebox" style="width:210px;height:26px" value="${notice.END_DATE }"/>
    </div>
    <div style="clear:both;"></div>
    <div class="i-common i-cnt-left">公告类型：</div>
    <div class="i-common i-cnt-right">
    	<input name="notice.NOTICE_KIND" id="noticeKind" class="easyui-textbox" style="width:210px;height:26px"/>
    </div>
    <div class="i-common i-cnt-middle">公告标题图片：</div>
    <div class="i-common i-cnt-right">
    	<div id="cancelUpload">
    	<input type="hidden" name="notice.TITLE_IMG_URL" value="${notice.TITLE_IMG_URL }"/>
    		<span style="120px;">
    			<c:choose>
    				<c:when test="${notice.TITLE_IMG_URL eq null }">
    					<div id="uploadFile"><input class="easyui-filebox" name="img" data-options="prompt:'请选择公告标题图片...'" style="width:210px;height:26px" accept="image/gif,image/jpeg,image/png"/></div>
    				</c:when>
    				<c:when test="${notice.TITLE_IMG_URL ne null }">
    					<div id="uploadFile" style="display:none;"><input class="easyui-filebox" name="img" data-options="prompt:'请选择公告标题图片...'" style="width:210px;height:26px" accept="image/gif,image/jpeg,image/png"/></div>
    					<div id="upload">
	    					<span style="width:130px; font-size:12px;color:red;">已上传</span>	    					
	    					<a id="btn" href="javascript:showImg('${notice.TITLE_IMG_URL}')" name="find"></a>
	    					<a id="btn" href="javascript:uploadImg()" name="upload"></a>
    					</div>
    				</c:when>
    			</c:choose>
    		</span>
    	</div>
    </div>
    <div class="i-common i-cnt-middle">公告内容路径：</div>
    <div class="i-common i-cnt-right">
    	<input name="notice.CONTENT_IMG_URL" id="contentUrl" class="easyui-textbox" style="width:210px;height:26px" value="${notice.CONTENT_IMG_URL }"/>
    </div>
    <div style="clear:both;"></div> 
    <div class="i-common i-cnt-left" style="width:99%; text-align:left;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;公告内容：</div>
    <div style="clear:both;"></div>
    <div class="i-common i-cnt-left" style="width:99%; text-align:left; background-color:white; height:auto;">
    	<input name="notice.NOTICE_CONTENT" class="easyui-textbox" data-options="multiline:true" id="content" style="width:990px;height:100px" value="${notice.NOTICE_CONTENT }"/>
    	<input type="hidden" name="notice.USERID" value="${notice.USERID }"/>
    	<input type="hidden" name="notice.CREATE_TIME" value="${notice.CREATE_TIME }"/>
    </div>
    <div style="clear:both;"></div>
</div>
<div id="dlg" class="easyui-dialog" title="公告标题图片查看" style="width:540px;height:240px;max-width:800px;padding:10px" data-options="
		onResize:function(){
			$(this).dialog('center');
		}">
		<img id="stationImg" src="" style="width:500px;height:170px;"/>
</div>
</form>
</body>
</html>